package org.hawk.gwt.ppc.scanner;

import java.net.URL;
import java.util.List;

/**
 * This interface represents scanner for the sources in the 
 * specific classpath root.
 * @author alex.bereznevatiy@gmail.com
 *
 */
public interface SourcesLoader {
	/**
	 * Resolves all java sources from the classpath root
	 * assigned. Returns list of class names that sources 
	 * are available. 
	 * @param packageName
	 * @return list of class names and never <code>null</code>
	 */
	List<String> getClasses(String packageName);
	/**
	 * @param packageName
	 * @return list of names of all subpackages 
	 * for package specified.
	 */
	List<String> getSubpackages(String packageName);
	/**
	 * @param name
	 * @return {@link URL} of resource with the name specified.
	 */
	URL getResource(String name);
	/**
	 * @param name of the class to load source. 
	 * This should be a top-level class.
	 * @return {@link URL} of class source with name specified.
	 */
	URL getClass(String name);
	/**
	 * @return URL presentation of this source loader or <code>null</code>
	 * if this source loader cannot be represented as single url.
	 * 
	 */
	URL toUrl();
	/**
	 * @param className
	 * @return true if sources for top-level class with name specified
	 * are available for current sources loader.
	 */
	boolean isClassExists(String className);
}
